Skip to content

Add medication adherence tracking - #230

Merged
mudabs merged 6 commits into
oss-slu:mainfrom
OliviaH05:feature/issue-169-medication-adherence
Nov 4, 2026
Merged

mudabs merged 6 commits into
oss-slu:mainfrom
OliviaH05:feature/issue-169-medication-adherence

Conversation

@OliviaH05

Copy link
Copy Markdown
Contributor

Summary:
Adds medication adherence tracking so users can record whether they took or skipped a scheduled medication dose and review their history.

Changes Made:

  • Add backend models for medication dose records, including does status and timestamp.
  • Added API endpoints to record taked or skipped doses and retrieve dose history.
  • Enforced user ownership and health consent requirements for dose tracking endpoints.
  • Added frontend buttons to mark medication doses as taken or skipped.
  • Added dose history display with timestamps, loading states, empty states, error messages, and retry functionality.
  • Added translations for English, Spanish, Chinese, Hindi, and Arabic.
  • Added backend and frontend tests for medication adherence functionality.

Closes #169

@mudabs mudabs left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, Olivia for adding the adherence model, API endpoints, UI controls, and localized feedback.

Please address these items before merge:

  • Tie each adherence record to a scheduled dose or date. MedicationDose currently stores only the prescription, status, and recording time, so repeated clicks create duplicate records and doses on different days cannot be distinguished. Add scheduled-dose semantics or explicitly define manual event logging, then test duplicate submissions and date handling.
  • Do not show adherence actions without schedule context, or provide a way to record the intended scheduled date.
  • Give each medication's taken, skipped, and history controls medication-specific accessible names or a labelled group for screen readers.
  • Format recorded_at using the selected application locale instead of the browser default.
  • Add tests for empty history, history-load failure and retry, and rejected requests when health consent is missing.

@mudabs mudabs left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, Olivia, for adding scheduled-dose tracking, duplicate protection, accessible medication controls, localized timestamps, and the requested consent and error-state coverage.

Please address these remaining items before approval:

  1. Resolve the SonarCloud quality gate failure. New-code duplication is 8.4%, above the required 3% limit. Refactor the duplicated adherence test setup or implementation and confirm SonarCloud passes.

  2. Update the frontend test i18n resources with the new adherence strings. The current tests assert raw keys such as recordTakenForMedication, so they do not verify the actual localized accessible names. Assert rendered medication-specific labels in at least English and one non-English locale.

All other CI checks pass. Please push the fixes and request another review.

@sonarqubecloud

sonarqubecloud Bot commented Nov 3, 2026

Copy link
Copy Markdown

@mudabs mudabs left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you Olivia for addressing the scheduled-dose tracking, duplicate protection, accessibility, localization, consent, and test coverage feedback.

All CI checks pass and the requested fixes are complete. I am merging this PR using an admin bypass because the previous review status was not refreshed.

@mudabs
mudabs merged commit 71640c7 into oss-slu:main Nov 4, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Small Rock] Add medication adherence records

2 participants